package com.bibrApp.difu.utils;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;

import com.bibrApp.difu.actvity.wait_delivery_mvp.WaitDeliveryActivity;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Tools {

    /**
     * c2c订单状态
     */
// 待交割
    public static final int WAIT_DELIVERY = 0;
    // 交割中
    public static final int DELIVERYING = 1;
    // 待抵押
    public static final int WAIT_MORTGAGE = 2;
    // 已抵押
    public static final int MORTGAGE = 3;
    // 待还款
    public static final int WAIT_REPAY = 4;
    // 待付款
    public static final int WAIT_PAY = 5;
    // 已付款
    public static final int PAY = 6;
    // 待收款
    public static final int WAIT_RECEIPTS = 7;
    // 待补仓
    public static final int COVER = 8;
    // 异常状态（部分投资人违约）
    public static final int EXECEPTION = 9;
    // 已逾期
    public static final int OVERDUE = 10;
    // 已平仓未提币
    public static final int LIQUIDATION_ING = 101;
    // 已结束
    public static final int ALL_END = 102;
    // 已取消
    public static final int CLOSE_END = 103;
    // 待签名
    public static final int SIGN_ING = 104;
    // 待审核
    public static final int SIGN_END = 105;
    // 违约未提币
    public static final int CANCEL_ING = 106;
    // 已还款未提币
    public static final int REPAYMENT_ING = 107;
    // 已平仓未收取手续费
    public static final int CLOSED_NOT_FEE = 108;
    // 提币中
    public static final int WITHDRAWAL_ING = 109;
    // 已还款未确认(未结束订单)
    public static final int REPAYMENT_NOT_OVER = 110;

    public static String getStatusText(int status) {
        if (status == 0) {
            return "待交割";
        } else if (status == 1) {
            return "交割中";
        } else if (status == 2) {
            return "待抵押";
        } else if (status == 3) {
            return "已抵押";
        } else if (status == 4) {
            return "待还款";
        } else if (status == 5) {
            return "待付款";
        } else if (status == 6) {
            return "已付款";
        } else if (status == 7) {
            return "待收款";
        } else if (status == 8) {
            return "待补仓";
        } else if (status == 9) {
            return "异常状态";
        } else if (status == 10) {
            return "已逾期";
        } else if (status == 101 || status == 106 || status == 107) {
            return "未提币";
        } else if (status == 102) {
            return "已结束";
        } else if (status == 103) {
            return "已取消";
        } else if (status == 104) {
            return "待签名";
        } else if (status == 105) {
            return "待审核";
        } else if (status == 108) {
            return "平仓";
        } else if (status == 109) {
            return "提币中";
        } else {
            return "已还款";
        }
    }

    public static String getTime(String createTime) {
        return createTime.substring(0, 19).replace("T", " ");
    }

    public static String getDoubleString(double data, String decimal) {
        DecimalFormat df1 = new DecimalFormat(decimal);
        return df1.format(data);
    }

    public static void copy(Context context, String str) {
        //获取剪贴板管理器：
        ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
// 创建普通字符型ClipData
        ClipData mClipData = ClipData.newPlainText("Label", str);
// 将ClipData内容放到系统剪贴板里。
        cm.setPrimaryClip(mClipData);
        ToastUtils.ShowToast(context, "已复制");
    }
}
